package com.ruoyi.yl.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: linKe
 * @Date: 2022/2/18 16:44
 * @FileName: MybatisPlusConfiguration
 * @version: 1.0
 * @Description: mybatisPlus配置类
 */
@Configuration
public class YlMybatisPlusConfiguration {

//    /**
//     * 分页bean
//     * @return
//     */
//    @Bean
//    public PaginationInterceptor paginationInterceptor(){
//        PaginationInterceptor interceptor = new PaginationInterceptor();
//        interceptor.setDialectType("mysql");
//        return interceptor;
//    }
    /**
     * 乐观锁拦截器配置
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return interceptor;
    }
}
